package com.cosc716.restaurant.domain;

import java.util.ArrayList;


public class Order {

	private int orderNo;
	private ArrayList<MenuItem> items;
	private double totalprice;
	private boolean isComplete;
	private Customer customer;
	private int prepTime; // indicates the remaining time needed to prep.
	
    public Order(int orderNo, Customer customer)
    {
    	
    	this.orderNo=orderNo;
     	items= new ArrayList<MenuItem>();
     	totalprice=0;
    	this.customer=customer;
    	
        }
    
    public int getOrderNo()
    {
    	return orderNo;
    }
    
    public int getPeopleNo(int peopleNo)
    {
    	return peopleNo;
    }
    public double getTotalprice(double totalprice)
    {
    	return totalprice;
    }    

	public int getPrepTime() {
		return prepTime;
	}

	public void setPrepTime(int prepTime) {
		this.prepTime = prepTime;
	}

	public Customer getCustomer()
    {
    	return customer;
    }
    public void setIsComplete(boolean isComplete)
    {
    	 this.isComplete=isComplete;
    }
    
    public boolean getIsComplete()
    {
    	return isComplete;
    }
    public ArrayList<MenuItem> getItems()
    {
    	return items;
    }
    
    public void deleteMenuItem(MenuItem item)
    {
    	items.remove(item);
    	totalprice -= item.getPrice();
    	
    }
    
    public void addMenuItem(MenuItem menuItem) {
    	items.add(menuItem);
    	totalprice += menuItem.getPrice();
    	
    	this.prepTime += menuItem.getPrepTime(); // add to the total preptime
    }
    
    public String toString()
    {
    	String result = "Order No:"+"\t" + orderNo+"\t"+"Customer ID "+customer.getCustomerId() +"\n";
    	result+="Itemname\t quantity\t price\n";
    	for(MenuItem item:items)
    		result+=item;
    	if(getIsComplete()==true)
    		result+="Order is complete";
    		else
    			result+="Order is in progress";
    			
    	return result;
    		
    		
    }


	}


